/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment_cp3120.ucm;

import assignment_cp3120.manager.promandgst.PromoGSTModel;
import assignment_cp3120.manager.promandgst.PromoGSTView;

/**
 * Promotion and gst use case.
 * 
 * PRECONDITION: view is shown
 *
 * 1. User fills in gst and promotion on view
 * 2. System takes data from view
 * 3. System updates tax
 * 4. System updates promotion
 *
 * POSTCONDITION: database is updated
 */
public class UCPromotionAndGST implements UseCaseController{
    private PromoGSTView view;
    private PromoGSTModel model;

    public UCPromotionAndGST() {
        this(new PromoGSTView(), new PromoGSTModel());
    }
    public UCPromotionAndGST(PromoGSTView view, PromoGSTModel model) {
        this.view = view;
        this.model = model;
    }

    public void run() {
        //* 2. System takes data from view
        int gst = view.getGST();
        int promo = view.getPromo();
        //* 3. System updates tax
        model.EditGST(gst);
        //* 4. System updates promotion
        model.EditPromo(promo);
    }
}
